import 'package:flutter/material.dart';

class CustomPageRoute extends PageRouteBuilder{
  Widget widget;
  CustomPageRoute(this.widget) : super(
    transitionDuration :const Duration(milliseconds: 1000),
    pageBuilder:(BuildContext context, Animation<double> animation1, Animation<double> animation2){
      return widget;
    },
    transitionsBuilder:(BuildContext context, Animation<double> animation1, Animation<double> animation2,Widget widget){
      return SlideTransition(
        //平移
        position: Tween<Offset>(begin: Offset(1.0, 0.0),end: Offset(0.0, 0.0)).animate(
          CurvedAnimation(parent: animation1, curve: Curves.fastOutSlowIn)
        ),
        child: ScaleTransition(
          //放缩
          scale: Tween<double>(begin: 0.8,end: 1.0).animate(
            CurvedAnimation(parent: animation1, curve: Curves.fastOutSlowIn)
          ),
          child: widget,
        ),
      );
    }
  );
  
}

